package org.mklink;

import org.mklink.util.AppUtil;
import org.mklink.util.LanguageUtil;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

import java.io.IOException;

public class MkLinkApplication extends Application {
    
    @Override
    public void start(Stage stage) throws IOException {
        // 初始化语言环境，默认使用中文
        LanguageUtil.switchToChinese();
        
        Image image = new Image("icon.png");
        stage.getIcons().add(image);
        FXMLLoader fxmlLoader = new FXMLLoader(MkLinkApplication.class.getResource("main-view.fxml"));
        Scene scene = new Scene(fxmlLoader.load());
        stage.setTitle(LanguageUtil.getString("app.title") + AppUtil.getAppVersion());
        stage.setScene(scene);
        stage.show();
        
        //检查更新
        AppUtil.checkUpdate();
    }
    
    public static void main(String[] args) {
        launch();
    }
}
